package com.baidu.automata.core.type;

import org.apache.commons.lang3.StringUtils;
import org.dom4j.Element;
import org.w3c.dom.Node;

public class IntegerField extends BasicDataField<Integer> {
	private Integer value;

	public IntegerField() {
		super();
	}

	public IntegerField(String id) {
		super(id);
	}

	@Override
	public Integer getValue() {
		return value;
	}

	@Override
	public void setValue(Integer value) {
		this.value = value;
	}

	@Override
	public void deserialize(Element e) throws Exception{
		this.id = e.attributeValue("id");
		String text = e.getTextTrim();
		this.value = (StringUtils.isBlank(text)) ? null : Integer.parseInt(text);
	}

	@Override
	public Node serialize() {
		return null;
	}
}
